package com.lsh.payment.core.strategy.bill;

import com.lsh.payment.core.model.payenum.PayChannel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Project Name: lsh-payment
 *
 * @author peter
 * @date 16/11/24
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
public class BillStrategyFactory {

    private static Map<String, BillStrategy> strategyMap = new ConcurrentHashMap<>();

    static {

        strategyMap.put(PayChannel.WXPAY.getName(), new WxBillStrategy());
        strategyMap.put(PayChannel.ALIPAY.getName(), new AliBillStrategy());
        strategyMap.put(PayChannel.QFPAY.getName(), new QfBillStrategy());
        strategyMap.put(PayChannel.LKLPAY.getName(), new LklBillStrategy());
        strategyMap.put(PayChannel.WXPAYGROUPON.getName(), new WxGrouponBillStrategy());
        strategyMap.put(PayChannel.ALLINPAY.getName(), new AllinBillStrategy());

        strategyMap.put(PayChannel.CMPAY.getName(),new CmBillStrategy());
        strategyMap.put(PayChannel.PURSE_PRE_PAY.getName(), new MisPurseBillStrategy());
    }

    private BillStrategyFactory() {

    }

    private static class InstanceHolder {
        public static BillStrategyFactory instance = new BillStrategyFactory();
    }

    public static BillStrategyFactory getInstance() {
        return BillStrategyFactory.InstanceHolder.instance;
    }

    public BillStrategy creator(String type) {
        return strategyMap.get(type);
    }
}
